package de.vocabulary.client;

import java.util.HashMap;
import java.util.Map;

import org.gwt.advanced.client.datamodel.ComboBoxDataModel;
import org.gwt.advanced.client.ui.widget.ComboBox;
import org.gwt.advanced.client.ui.widget.cell.ComboBoxCell;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.VerticalPanel;

import de.vocabulary.client.service.VocabularyService;
import de.vocabulary.client.service.VocabularyServiceAsync;
import de.vocabulary.shared.model.LanguageModule;

public class VocabularyTrainer2 implements EntryPoint {

	/** * This is the entry point method. */

	public void onModuleLoad() {
		VocabularyServiceAsync service = VocabularyServiceProvider.getService();
		service.getDefaultLanguageModule(new LoadLanguageCallback());

	}

	private void initScreen() {

		// Page setup
		VerticalPanel vPanel = new VerticalPanel();
		vPanel.setWidth("100%");
		vPanel.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER);

		// vPanel.add(table);
		vPanel.add(new OverallScreen());
		/*
		 * vPanel.add(addVocButton); vPanel.add(saveButton);
		 * vPanel.add(getTranslationsButton); //vPanel.add(vocBinder);
		 */

		// Add table and buttons to the RootPanel
		RootPanel.get().add(vPanel);

	}

	class LoadLanguageCallback implements AsyncCallback<LanguageModule> {

		@Override
		public void onFailure(Throwable caught) {
			// TODO Auto-generated method stub

		}

		@Override
		public void onSuccess(LanguageModule result) {
			LanguageModuleManager.getLanguageModuleManager().setLanguageModel(
					result);
			System.out.println("Loaded language module "+result.getName());
			initScreen();

		}

	}

}
